import request from '@/utils/request'
import type { GoodsQuery, GoodsList, UpdataState } from '@/types/goods'
import type { ApiRes } from '@/types/data'
import { url } from 'inspector'

// 商品分类数据
export const getCateGory = () => {
  return request<ApiRes<string[]>>({
    url: 'pro/getCategory'
  })
}

// 查询商品列表数据
export const getGoodsList = (params: GoodsQuery) => {
  return request<ApiRes<GoodsList>>({
    url: 'pro/list?',
    params
  })
}

// 改变商品三个状态
export const updataStatus = (data: UpdataState) => {
  return request<{ code: number; message: string }>({
    url: 'pro/updateFlag',
    method: 'POST',
    data
  })
}
